using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;

namespace NhaThuocOnline.Entities.Mapping
{
    public class ICDVaHoaDonBanHangMap : EntityTypeConfiguration<ICDVaHoaDonBanHang>
    {
        public ICDVaHoaDonBanHangMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.ID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            // Table & Column Mappings
            this.ToTable("ICDVaHoaDonBanHang");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.HoaDonBanHangId).HasColumnName("HoaDonBanHangId");
            this.Property(t => t.ICDId).HasColumnName("ICDId");

            // Relationships
            this.HasOptional(t => t.HoaDonBanHang)
                .WithMany(t => t.ICDVaHoaDonBanHangs)
                .HasForeignKey(d => d.HoaDonBanHangId);
            this.HasOptional(t => t.ICD)
                .WithMany(t => t.ICDVaHoaDonBanHangs)
                .HasForeignKey(d => d.ICDId);

        }
    }
}
